package com.dbsop.domain.rest.agg;

import com.dbsop.domain.rest.AggTransportOperation;
import org.elasticsearch.search.aggregations.AggregationBuilder;
import org.elasticsearch.search.aggregations.AggregationBuilders;

/**
 * 平均值
 */
public class RestAvg extends RestAgg implements AggTransportOperation {


    public RestAvg(String fieldName) {
        super(fieldName);
    }

    public RestAvg(String fieldName, String formatName) {
        super(fieldName, formatName);
    }

    @Override
    public AggregationBuilder aggregationBuilder() {
        return  AggregationBuilders.avg(formatName).field(fieldName);
    }
}
